#include "TcpServer.hpp"
#include <memory>
#include "Http.hpp"

void Usage(string proc)
{
    cout << "Usage: " << " +port" << endl;
}
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(0);
    }
    uint16_t serverport = stoi(argv[1]);
    Http http;
    func_t server = bind(&Http::HttpRequest, &http, placeholders::_1);

    unique_ptr<TcpServer> upts = make_unique<TcpServer>(serverport, server);
    upts->InitServer();
    upts->Loop();

    return 0;
}